﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
namespace LitTools
{
    /// <summary>
    /// 物体点击过滤器
    /// 包含在goList的物体可以通过
    /// </summary>
    public class GameObjectListFilter : IRaycastResultFilter
    {
        public List<GameObject> goList = new();

        public List<RaycastResult> FiltRaycastResults(List<RaycastResult> result)
        {
            List<RaycastResult> targets = new();
            for (int i = 0; i < result.Count; i++)
            {
                if (goList.Contains(result[i].gameObject))
                    targets.Add(result[i]);
            }
            return targets;
        }
    }
}